﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Espam.Idiomas.Decimo.Tesis.Web
{
    public partial class UI_ProfileAdministrators : System.Web.UI.Page
    {
        string validaSession="";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
                Response.Cache.SetAllowResponseInBrowserHistory(false);
                Response.Cache.SetNoStore();

                if (Session["userEspamIdiomasVarSession001"] == null || Session["rolEspamIdiomasVarSession003"] == null)
                {
                    validaSession = "NoHaIniciadoSession";
                    Response.Redirect("UI_Login.aspx?validaSession=" + validaSession);
                }
                else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Docente")
                {
                    Response.Redirect("UI_DashboardTeacher.aspx");
                }
                else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Administradores")
                {
                    DatosAlumno();
                }
                else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Alumno")
                {
                    Response.Redirect("UI_DashboardStudents.aspx");
                }
            }
        }

        private void DatosAlumno()
        {
            lblNombres.Text = Session["nameEspamIdiomasVarSession006"].ToString();
            lblApellidos.Text = Session["lastNameEspamIdiomasVarSession005"].ToString();
            lblDocumento.Text = Session["userEspamIdiomasVarSession001"].ToString();
            lblEstado.Text = "Activo";
            lblUsuarioTipo.Text = Session["rolEspamIdiomasVarSession003"].ToString();
            imgPerfil.ImageUrl = "UploadedImagesTeachers/" + Session["cadPicEspamIdiomasVarSession005"].ToString() + ".jpg";
        }
    }

}